var url =  require('url');
console.log(url.parse('http://user:pass@host.com:8080/p/a/t/h?query=string#hash',true));